<template>
  <component :is="currentView"></component>
</template>

<script>
import axios from 'axios'
import 'babel-polyfill'
export default {
  head: {
    htmlAttrs: {
      'class': 'mobile'
    }
  },
  asyncData (context) {
    let { store } = context
    const paltformView = store.state.platform === 'PC' ? 'Index' : 'IndexMobile'
    return axios.get('http://192.168.26.8:8000/config.json').then((res) => {
      store.commit('setConfig', res.data.data)
      return {
        currentView: paltformView
      }
    })
  },
  components: {
    Index: () => import('../components/Index.vue'),
    IndexMobile: () => import('../components/IndexMobile.vue')
  },
  mounted () {
    console.log(process.env.NODE_ENV)
  }
}
</script>

<style>

</style>
